import request from '@/utils/request'

/**
 * 实现新增部门
 * @param {code,introduce,manager,name,pid} data
 * @returns
 */
export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

/**
 * 实现查询部门
 * @param
 * @returns
 */
export function getDepartments() {
  return request({
    url: '/company/department'

  })
}

/**
 * 实现修改部门
 * @param {code,introduce,manager,name,pid,id} data
 * @returns
 */
export function updateDepartments(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}

/**
 * 实现删除部门
 * @param {id}
 * @returns
 */
export function delDepartments(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'

  })
}

/**
 * 实现根据id查询部门
 * @param {id}
 * @returns
 */
export function getDepartmentDetail(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'

  })
}

